// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.audio.parameters;

import zombie.audio.FMODLocalParameter;
import zombie.core.math.PZMath;
import zombie.vehicles.BaseVehicle;
import zombie.vehicles.VehiclePart;

public class ParameterVehicleEngineCondition extends FMODLocalParameter {
    private final BaseVehicle vehicle;

    public ParameterVehicleEngineCondition(BaseVehicle _vehicle) {
        super("VehicleEngineCondition");
        this.vehicle = _vehicle;
    }

    @Override
    public float calculateCurrentValue() {
        VehiclePart vehiclePart = this.vehicle.getPartById("Engine");
        return vehiclePart == null ? 100.0F : (float)PZMath.clamp(vehiclePart.getCondition(), 0, 100);
    }
}
